

#ifndef _UCEDINPT_H
#define _UCEDINPT_H

#include "zrxobject.h"
#include "zdbmain.h"

#pragma pack (push, 8)

#pragma warning (disable: 4786)

class UcEdInputPointFilter;
class UcEdInputPointMonitor;
class UcApDocument;
class UcEdInputContextReactor;
class UcDbCustomOsnapMode;
class UcEdSubSelectFilter;

class UcEdInputPointManager
{
  public:
	virtual ~UcEdInputPointManager() { }
    virtual Ucad::ErrorStatus     registerPointFilter(UcEdInputPointFilter* pFilter) = 0;

    virtual Ucad::ErrorStatus     revokePointFilter() = 0;

    virtual UcEdInputPointFilter* currentPointFilter() const = 0;

    virtual Ucad::ErrorStatus addPointMonitor(UcEdInputPointMonitor* pMonitor) = 0;

    virtual Ucad::ErrorStatus removePointMonitor(UcEdInputPointMonitor* pMonitor) = 0;

    virtual Ucad::ErrorStatus addInputContextReactor(UcEdInputContextReactor* pReactor) = 0;

    virtual Ucad::ErrorStatus removeInputContextReactor(UcEdInputContextReactor* pReact) = 0;

    virtual Ucad::ErrorStatus disableSystemCursorGraphics() = 0;

    virtual Ucad::ErrorStatus enableSystemCursorGraphics() = 0;

    virtual int systemCursorDisableCount() const = 0;

    virtual Ucad::ErrorStatus turnOnForcedPick() = 0;

    virtual Ucad::ErrorStatus turnOffForcedPick() = 0;

    virtual int forcedPickCount() const = 0;

    virtual int mouseHasMoved() const = 0;

    virtual Ucad::ErrorStatus turnOnSubentityWindowSelection() = 0;
    virtual Ucad::ErrorStatus turnOffSubentityWindowSelection() = 0;

	virtual void enableMultiSubentPathSelection(bool bEnable) = 0;

    virtual Ucad::ErrorStatus addSubSelectFilter(
            UcEdSubSelectFilter* pSSSubFilter) = 0;

    virtual Ucad::ErrorStatus removeSubSelectFilter(
            UcEdSubSelectFilter* pSSSubFilter) = 0;

};


class UcEdImpInputPointFilterResult;
class UcEdImpInputPointManager;

#ifdef _ZSOFT_WINDOWS_
	#ifndef UCAD_PORT
		#define UCAD_PORT
	#endif
#else
	#undef UCAD_PORT
	#define UCAD_PORT
#endif // _ZSOFT_WINDOWS_

class UCAD_PORT UcEdInputPoint
{
private:
	UcEdImpInputPointManager* m_pImpMgr;
	UcEdInputPoint(UcEdImpInputPointManager* pImpMgr);
	UcEdInputPoint & operator=(const UcEdInputPoint&);
public:
	UcApDocument*                            document() const;
	bool                                     pointComputed() const;
	int                                      history() const;
	const UcGePoint3d&                       lastPoint() const;
	const UcGePoint3d&                       rawPoint() const;
	const UcGePoint3d&                       grippedPoint() const;
	const UcGePoint3d&                       cartesianSnappedPoint() const;
	const UcGePoint3d&                       osnappedPoint() const;
	const UcDb::OsnapMask                    osnapMask() const;
	const UcArray<UcDbCustomOsnapMode*>&     customOsnapModes() const;
	const UcDb::OsnapMask                    osnapOverrides() const;
	const UcArray<UcDbCustomOsnapMode*>&     customOsnapOverrides() const;
	const UcArray<UcDbObjectId>&             pickedEntities() const;
	const UcArray<UcDbObjectIdArray, UcArrayObjectCopyReallocator<UcDbObjectIdArray>>& nestedPickedEntities() const;
	const UcArray<ZSoft::GsMarker>&          gsSelectionMark() const;
	const UcArray<UcDbObjectId>&             keyPointEntities() const;
	const UcArray<UcDbObjectIdArray, UcArrayObjectCopyReallocator<UcDbObjectIdArray>>&nestedKeyPointEntities() const;
	const UcArray<ZSoft::GsMarker>&          keyPointGsSelectionMark() const;
	const UcArray<UcGeCurve3d*>&             alignmentPaths() const;
	const UcGePoint3d&                       computedPoint() const;
	const ZTCHAR*                            tooltipString() const;
	UcGiViewportDraw*                        drawContext() const;
	friend class UcEdImpInputPointManager;
};

class UCAD_PORT UcEdInputPointFilterResult
{
private:
	UcEdImpInputPointFilterResult* m_pImp;
	UcEdInputPointFilterResult();
	UcEdInputPointFilterResult& operator=(const UcEdInputPointFilterResult&);
public:
	~UcEdInputPointFilterResult();
	void                             setNewPoint(const UcGePoint3d& newValue);
	void                             setDisplayOsnapGlyph(bool newValue);
	void                             setNewTooltipString(const ZTCHAR* newValue);
	void                             setRetry(bool newValue);

	const UcGePoint3d&               newPoint() const;
	bool                             displayOsnapGlyph() const;
	const ZTCHAR*                    newTooltipString() const;
	bool							 retry() const;

	friend class UcEdImpInputPointManager;
};

class UcEdImpInputPointMonitorResult;
class UCAD_PORT UcEdInputPointMonitorResult
{
private:
	UcEdImpInputPointMonitorResult* m_pImp; 
	UcEdInputPointMonitorResult();
	UcEdInputPointMonitorResult& operator=(const UcEdInputPointMonitorResult&);
public:
	~UcEdInputPointMonitorResult();
	void setAdditionalTooltipString(const ZTCHAR*);

	bool appendToTooltipStr() const;
	const ZTCHAR* additionalTooltipString() const;

	friend class UcEdImpInputPointManager;
};

class UcEdInputPointFilter : public UcRxObject
{

  public:
    UCRX_DECLARE_MEMBERS(UcEdInputPointFilter);

    virtual Ucad::ErrorStatus processInputPoint(
          bool&                        changedPoint,
          UcGePoint3d&                 newPoint,
          bool&                        displayOsnapGlyph,

          bool&                        changedTooltipStr,
          ZTCHAR*&                     newTooltipString,

          bool&                        retry,

          UcGiViewportDraw*           drawContext,

          UcApDocument*              document,

          bool                       pointComputed,

          int                        history,

          const UcGePoint3d&               lastPoint,

          const UcGePoint3d&               rawPoint,

          const UcGePoint3d&               grippedPoint,

          const UcGePoint3d&               cartesianSnappedPoint,

          const UcGePoint3d&               osnappedPoint,
          UcDb::OsnapMask                  osnapMask,
          const UcArray<UcDbCustomOsnapMode*>& customOsnapModes,

          UcDb::OsnapMask                  osnapOverrides,
          const UcArray<UcDbCustomOsnapMode*>& customOsnapOverrides,

          const UcArray<UcDbObjectId>&     pickedEntities,
          const UcArray< UcDbObjectIdArray, UcArrayObjectCopyReallocator< UcDbObjectIdArray > >&
                                           nestedPickedEntities,
          const UcArray<ZSoft::GsMarker>&  gsSelectionMark,

          const UcArray<UcDbObjectId>&     keyPointEntities,
          const UcArray< UcDbObjectIdArray, UcArrayObjectCopyReallocator< UcDbObjectIdArray > >&
                                           nestedKeyPointEntities,
          const UcArray<ZSoft::GsMarker>&  keyPointGsSelectionMark,

          const UcArray<UcGeCurve3d*>&       alignmentPaths,

          const UcGePoint3d&               computedPoint,

          const ZTCHAR*                      tooltipString) {	return Ucad::eOk; }
		  UCAD_PORT virtual Ucad::ErrorStatus processInputPoint(const UcEdInputPoint& input, UcEdInputPointFilterResult& output);
	  virtual UcEdInputPointFilter* revokeInputFilter(UcEdInputPointFilter* revokedFilter)                { return this; }
};

class UcEdInputPointMonitor : public UcRxObject
{
    public:
    UCRX_DECLARE_MEMBERS(UcEdInputPointMonitor);

    virtual Ucad::ErrorStatus monitorInputPoint(

          bool&                             appendToTooltipStr,
          ZTCHAR*&                            additionalTooltipString,

          UcGiViewportDraw*                   drawContext,

          UcApDocument*                       document,
          bool                                pointComputed,
          int                                 history,
          const UcGePoint3d&                  lastPoint,
          const UcGePoint3d&                  rawPoint,
          const UcGePoint3d&                  grippedPoint,
          const UcGePoint3d&                  cartesianSnappedPoint,
          const UcGePoint3d&                  osnappedPoint,
          UcDb::OsnapMask                     osnapMask,
          const UcArray<UcDbCustomOsnapMode*>& customOsnapModes,
          UcDb::OsnapMask                     osnapOverrides,
          const UcArray<UcDbCustomOsnapMode*>& customOsnapOverrides,
          const UcArray<UcDbObjectId>&        apertureEntities,
          const UcArray< UcDbObjectIdArray, UcArrayObjectCopyReallocator< UcDbObjectIdArray > >& 
                                              nestedApertureEntities,
          const UcArray<ZSoft::GsMarker>&     gsSelectionMark,
          const UcArray<UcDbObjectId>&        keyPointEntities,
          const UcArray< UcDbObjectIdArray, UcArrayObjectCopyReallocator< UcDbObjectIdArray > >&
                                              nestedKeyPointEntities,
          const UcArray<ZSoft::GsMarker>&     keyPointGsSelectionMark,
          const UcArray<UcGeCurve3d*>&        alignmentPaths,
          const UcGePoint3d&                  computedPoint,
          const ZTCHAR*                         tooltipString) {	return Ucad::eOk; }
		  UCAD_PORT virtual Ucad::ErrorStatus monitorInputPoint(const UcEdInputPoint& input, UcEdInputPointMonitorResult& output);

    virtual bool
        excludeFromOsnapCalculation (const UcArray<UcDbObjectId>& nestedEntity,
                                     ZSoft::GsMarker gsSelectionMark)
                                    { return false; }
};

class UcEdInputContextReactor
{
public:
	virtual ~UcEdInputContextReactor() { }
    virtual void beginGetPoint(const UcGePoint3d* pointIn,
                               const ZTCHAR* promptString,
                               int   initGetFlags,
                               const ZTCHAR* pKeywords) { }

    virtual void endGetPoint(Ucad::PromptStatus returnStatus,
                             const UcGePoint3d& pointOut,
                             const ZTCHAR*& pKeyword) { }

    virtual void beginGetAngle(const UcGePoint3d* pointIn,
                               const ZTCHAR* promptString,
                               int   initGetFlags,
                               const ZTCHAR* pKeywords) { }

    virtual void endGetAngle(Ucad::PromptStatus returnStatus,
                             double& angle,
                             const ZTCHAR*& pKeyword) { }

    virtual void beginGetDistance(const UcGePoint3d* pointIn,
                                  const ZTCHAR* promptString,
                                  int   initGetFlags,
                                  const ZTCHAR* pKeywords) { }

    virtual void endGetDistance(Ucad::PromptStatus returnStatus,
                                double& distance,
                                const ZTCHAR*& pKeyword) { }

    virtual void beginGetOrientation(const UcGePoint3d* pointIn,
                                     const ZTCHAR* promptString,
                                     int   initGetFlags,
                                     const ZTCHAR* pKeywords) { }

    virtual void endGetOrientation(Ucad::PromptStatus returnStatus,
                                   double& angle,
                                   const ZTCHAR*& pKeyword) { }

    virtual void beginGetCorner(const UcGePoint3d* firstCorner,
                                const ZTCHAR* promptString,
                                int   initGetFlags,
                                const ZTCHAR* pKeywords) { }
    
    virtual void endGetCorner(Ucad::PromptStatus returnStatus,
                              UcGePoint3d& secondCorner,
                              const ZTCHAR*& pKeyword) { }

    virtual void beginGetScaleFactor(const UcGePoint3d* pointIn,
                                     const ZTCHAR* promptString,
                                     int   initGetFlags,
                                     const ZTCHAR* pKeywords) { }

    virtual void endGetScaleFactor(Ucad::PromptStatus returnStatus,
                                   double& distance,
                                   const ZTCHAR*& pKeyword) { }

    virtual void beginGetString(const ZTCHAR* promptString,
                                int   initGetFlags) { }

    virtual void endGetString (Ucad::PromptStatus returnStatus,
                               ZTCHAR* pString) { }

    virtual void beginGetKeyword(const ZTCHAR* promptString,
                                 int   initGetFlags,
                                 const ZTCHAR* pKeywords) { }

    virtual void endGetKeyword (Ucad::PromptStatus returnStatus,
                                const ZTCHAR*& pKeyword) { }

    virtual void beginGetInteger(const int* dfault, 
                                const ZTCHAR* promptString,
                                int   initGetFlags,
                                const ZTCHAR* pKeywords) { }

    virtual void endGetInteger(Ucad::PromptStatus returnStatus,
                               int& retValue,
                               const ZTCHAR*& pKeyword) { }

    virtual void beginGetColor(const int* dfault, 
                               const ZTCHAR* promptString,
                               int   initGetFlags,
                               const ZTCHAR* pKeywords) { }

    virtual void endGetColor(Ucad::PromptStatus returnStatus,
                             int& retValue,
                             const ZTCHAR*& pKeyword) { }

    virtual void beginGetReal(const double* dfault, 
                              const ZTCHAR* promptString,
                              int   initGetFlags,
                              const ZTCHAR* pKeywords) { }

    virtual void endGetReal(Ucad::PromptStatus returnStatus,
                            double& returnValue,
                            const ZTCHAR*& pKeyword) { }

    virtual void beginEntsel(const ZTCHAR* promptString,
                             int   initGetFlags,
                             const ZTCHAR* pKeywords) { }

    virtual void endEntsel(Ucad::PromptStatus returnStatus,
                           UcDbObjectId& entPicked,
                           UcGePoint3d& pickPoint,
                           const ZTCHAR* pKeyword) { }

    virtual void beginNentsel(const ZTCHAR*    promptString,
                              ZSoft::Boolean pickFlag,
                              int            initGetFlags,
                              const ZTCHAR*    pKeywords) { }

    virtual void endNentsel(Ucad::PromptStatus returnStatus,
                            UcDbObjectId entPicked,
                            const UcGePoint3d&  pickPoint,
                            const UcGeMatrix3d& xform,
                            const resbuf* referenceStack,
                            const ZTCHAR*   pKeyword) { }

    virtual void beginSSGet(const ZTCHAR*  pPrompt,
                            int          initGetFlags,
                            const ZTCHAR*  pKeywords,
                            const ZTCHAR*  pSSControls,
                            const UcArray<UcGePoint3d>& points,
                            const resbuf*               entMask) { }

    virtual void endSSGet(Ucad::PromptStatus returnStatus,
                          const UcArray<UcDbObjectId>& ss) { }

    virtual void beginDragSequence(const ZTCHAR*  promptString) { }

    virtual void endDragSequence(Ucad::PromptStatus returnStatus,
                                 UcGePoint3d&  pickPoint,
                                 UcGeVector3d& vec) { }

    virtual void beginQuiescentState() { }

    virtual void endQuiescentState() { }
};


#pragma pack (pop)
#endif  
